using Cinemachine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;

public class cameraChange : MonoBehaviour
{
    private CinemachineVirtualCamera cam;
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    public void Awake()
    {
        cam = GetComponentInChildren<CinemachineVirtualCamera>();
        cam.enabled = false;
    }
    public void OnTriggerEnter2D(Collider2D collision)
    {
        if(collision is CapsuleCollider2D && collision.CompareTag("Player"))
        {
            cam.enabled = true;
            cam.Priority = 12;
        }
    }

    public void OnTriggerExit2D(Collider2D collision)
    {
        if(collision is CapsuleCollider2D && collision.CompareTag("Player"))
        {
            cam.enabled = false;
            cam.Priority = 10;
        }
    }
}
